﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GrewalCRM.Entities
{
  [Serializable]
  public class UserCRM : BaseEntitiesGrewalCRM
  {
    #region Members    
    private string loginID;
    private string password;
    private int role;
    private string userName;
    private string address;
    private string mobileNo;
    private DateTime doj;    
    #endregion

    #region Constructors
		/// <summary>
		/// Create a new instance using the default constructor
		/// </summary>
		public UserCRM()
		{
			
		}
		
		/// <summary> 
		/// Create a new object by specifying all fields (except the auto-generated primary key field). 
		/// </summary> 
    public UserCRM(string loginID, string password, int role, string userName, string address, string mobileNo, DateTime doj, bool isActive, UserCRM lastModifiedUser)
      : base(isActive, lastModifiedUser)
		{			
			this.loginID = loginID;
			this.password = password;
			this.role = role;
			this.userName = userName;
			this.address = address;
			this.mobileNo = mobileNo;
			this.doj = doj;			
		}
			

    /// <summary> 
    /// Create an object from an existing row of data with only ID feild 
    /// </summary> 
    public UserCRM(int userID)
      : base(userID, false,  null, null)
    {
      
    }

		/// <summary> 
		/// Create an object from an existing row of data.
		/// </summary> 
    public UserCRM(int userID, string loginID, string password, int role, string userName, string address, string mobileNo, DateTime doj, bool isActive, UserCRM lastModifiedUser, DateTime? lastModifiedDateTime)
      : base(userID, isActive, lastModifiedUser, lastModifiedDateTime)
		{      
			this.ID = userID;
			this.loginID = loginID;
			this.password = password;
			this.role = role;
			this.userName = userName;
			this.address = address;
			this.mobileNo = mobileNo;
			this.doj = doj;			
		}
		#endregion

    #region Public Properties    
    /// <summary>
    /// Property relating to database column LoginID
    /// </summary>    
    public string LoginID
    {
      get { return loginID.TrimEnd(); }
      set { IsChanged |= loginID != value; loginID = value; }
    }

    /// <summary>
    /// Property relating to database column Password
    /// </summary>    
    public string Password
    {
      get { return password.TrimEnd(); }
      set { IsChanged |= password != value; password = value; }
    }

    /// <summary>
    /// Property relating to database column Role
    /// </summary>    
    public int Role
    {
      get { return role; }
      set { IsChanged |= role != value; role = value; }
    }

    /// <summary>
    /// Property relating to database column UserName
    /// </summary>    
    public string UserName
    {
      get { return userName.TrimEnd(); }
      set { IsChanged |= userName != value; userName = value; }
    }

    /// <summary>
    /// Property relating to database column Address
    /// </summary>    
    public string Address
    {
      get { return address != null ? address.TrimEnd() : string.Empty; }
      set { IsChanged |= address != value; address = value; }
    }

    /// <summary>
    /// Property relating to database column MobileNo
    /// </summary>    
    public string MobileNo
    {
      get { return mobileNo.TrimEnd(); }
      set { IsChanged |= mobileNo != value; mobileNo = value; }
    }

    /// <summary>
    /// Property relating to database column DOJ
    /// </summary>    
    public DateTime Doj
    {
      get { return doj; }
      set { IsChanged |= doj != value; doj = value; }
    }
    
    #endregion

    

    
  }
}
